package mvc.views.components.main
{
	import alternativa.gui.alternativagui;
	import alternativa.gui.container.gridContainer.AutoLODGridContainer;
	import alternativa.gui.container.gridContainer.GridContainer;
	import alternativa.gui.container.linear.VBox;
	import alternativa.gui.container.linear.VBoxExpand;
	import alternativa.gui.data.DataProvider;
	import alternativa.gui.enum.Align;
	import alternativa.gui.theme.defaulttheme.controls.buttons.CheckBox;
	import alternativa.gui.theme.defaulttheme.controls.text.TextArea;
	
	import consts.AuthType;
	
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.utils.Dictionary;
	
	import mvc.models.VOs.AuthItemVO;
	import mvc.models.VOs.AuthManageListVO;
	import mvc.models.proxys.ProxyAuth;
	
	import utils.UtilsUIManager;
	
	import xl.utils.UtilsGC;
	
	use namespace alternativagui;

	/**
	 * 查看权限角色信息
	 * @author XiLing
	 */
	public class ContentAuthItem extends ContentBase
	{
		public static const NAME:String = 'ContentAuthItem';
		
		private static const COL_NUM:int = 5;
		private var mainContainer:GridContainer;
		private var authCheckBoxs:Vector.<CheckBox>;
		private var items:Dictionary;
		public function ContentAuthItem()
		{
			super();
			
			authCheckBoxs = new Vector.<CheckBox>();
		}
		
		override protected function initUI():void
		{
			// TODO Auto Generated method stub
			super.initUI();
			
			
		}
		
		override public function update($model:Object):void
		{
			super.update($model);
			
			if(!$model)
			{
				ProxyAuth.getInstance().getAll();
			}
			
			UtilsGC.clearChildren(mainContainer);
			
			var model:Vector.<AuthItemVO> = $model as Vector.<AuthItemVO>;
			var len:int=model.length;
			mainContainer = new GridContainer(3,len+1,0,0);
			UtilsUIManager.createLabel(mainContainer,AuthType.NAME,0,0,100,20);
			UtilsUIManager.createDropdownList(mainContainer,createDropDownTypeData(),0,0,100,20);
			UtilsUIManager.createLabel(mainContainer,AuthType.OPERATION,0,0,100,20);
			for(var i:int=0;i<len;++i)
			{
				
			}
			addChild(mainContainer);
			resize(_w,_h);
		}
		
		private function createDropDownTypeData():DataProvider
		{
			var dpData:DataProvider = new DataProvider();
			for(var i:int=0;i<3;++i)
			{
				var object:Object = {label:AuthType['TYPE_'+i],icon:null};
				dpData.addItem(object);
			}
			return dpData;
		}
		
		private function onClick(evt:Event):void
		{
			
		}
		
		override public function resize($w:int, $h:int):void
		{
			// TODO Auto Generated method stub
			super.resize($w, $h);
			
			if(mainContainer)
				mainContainer.resize($w,$w);
			//grid.resize(_w,_h);
		}
		
	}
}